package com.igeek.javase.ch05.JDBC.dao;

import com.igeek.javase.map.Employee;
import com.igeek.javase.ch05.JDBC.utils.JDBCUtilsByC3P0;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;
/**
 * @author chenmin
 * 2023/7/20 15:54
 * @description TODO
 */
public class EmployeeDao extends BaseDao<Employee>{

    //根据员工ID，查询员工的姓名和所在部门名称
    public List<Map<String,Object>> selectEmpAndDept() throws SQLException {
        String sql = "select e.first_name , d.department_name from employees e join departments d " +
                "on e.department_id = d.department_id";
        List<Map<String, Object>> maps = this.selectMap(JDBCUtilsByC3P0.getConn(), sql);
        return maps;
    }

}
